# -*- coding: utf-8 -*-
from fastapi import APIRouter

from .dual_control_router import upload_dul_control_excel_file, get_dc_files_by_name, get_dc_file_by_id, \
    list_dc_files, update_dc_file, delete_dc_file, download_dc_original
from .accident_case_router import list_ac_files, upload_accident_case_file, update_ac_file, delete_ac_file
from .emergency_plan_router import (
    upload_emergency_plan_file,
    list_emergency_plan_files,
    get_emergency_plan_file_by_id,
    search_emergency_plan_files,
    update_emergency_plan_file,
    delete_emergency_plan_file,
)
from .question_answer_router import update_file_info, delete_file, upload_file, show_file_list
from .audio_router import upload_audio, list_audio, get_audio_by_id, delete_audio, update_audio

router = APIRouter()

# 知识问答
router.get("/knowledge/list_files", tags=["Knowledge"], summary="列出所有文件")(show_file_list)
# router.post("/knowledge/mapping_kb_search_type", tags=["Knowledge"], summary="知识库搜索类型映射")(mapping_kb_search_type)
router.post("/knowledge/upload_file", tags=["Knowledge"], summary="上传pdf文件")(upload_file)
router.put("/knowledge/update_file_info", tags=["Knowledge"], summary="修改文件信息")(update_file_info)
router.delete("/knowledge/delete_file", tags=["Knowledge"], summary="删除文件")(delete_file)

# 事故案例
router.post("/accident_case/upload_file", tags=["AccidentCase"], summary="上传事故清单pdf文件")(upload_accident_case_file)
router.get("/accident_case/list", tags=["AccidentCase"], summary="事故清单列表")(list_ac_files)
router.put("/accident_case/update", tags=["AccidentCase"], summary="更新文件名或用户组")(update_ac_file)
router.delete("/accident_case/delete/{file_id}", tags=["AccidentCase"], summary="逻辑删除文件")(delete_ac_file)

# 双控清单
router.get("/dual_control/download/{file_id}", tags=["DualControl"], summary="下载双控清单原始文件")(download_dc_original)
router.get("/dual_control/list", tags=["DualControl"], summary="双控清单列表")(list_dc_files)
router.get("/dual_control/by_name", tags=["DualControl"], summary="按文件名查询")(get_dc_files_by_name)
router.post("/dual_control/upload_file", tags=["DualControl"], summary="上传双控清单excel文件")(upload_dul_control_excel_file)
router.put("/dual_control/update", tags=["DualControl"], summary="更新文件名或用户组")(update_dc_file)
router.delete("/dual_control/delete/{file_id}", tags=["DualControl"], summary="逻辑删除文件")(delete_dc_file)

# 应急预案
router.post("/emergency_plan/upload_file", tags=["EmergencyPlan"], summary="上传应急预案文件")(upload_emergency_plan_file)
router.get("/emergency_plan/list", tags=["EmergencyPlan"], summary="应急预案列表")(list_emergency_plan_files)
router.get("/emergency_plan/{file_id}", tags=["EmergencyPlan"], summary="按ID获取应急预案")(get_emergency_plan_file_by_id)
router.get("/emergency_plan/by_name", tags=["EmergencyPlan"], summary="按文件名查询")(search_emergency_plan_files)
router.put("/emergency_plan/update", tags=["EmergencyPlan"], summary="更新文件名、场景、组或事故类型")(update_emergency_plan_file)
router.delete("/emergency_plan/delete/{file_id}", tags=["EmergencyPlan"], summary="逻辑删除文件")(delete_emergency_plan_file)

# 音频
router.post("/audio/upload_file", tags=["Audio"], summary="上传音频文件")(upload_audio)
router.get("/audio/list", tags=["Audio"], summary="音频列表")(list_audio)
router.get("/audio/detail/{audio_id}", tags=["Audio"], summary="按ID获取音频")(get_audio_by_id)
router.delete("/audio/delete/{audio_id}", tags=["Audio"], summary="逻辑删除音频")(delete_audio)
router.put("/audio/update/{audio_id}", tags=["Audio"], summary="更新音频")(update_audio)
